This invention relates generally to message transaction systems, and more particularly to utilizing only a single input/output (I/O) session to commit a single transaction.
When organizations need to have large-scale computer systems that hold mission critical information, such as purchase orders, financial information, etc., they usually resort to message transaction systems. Message transaction systems ensure that data is not lost if the system crashes, and also that data is not duplicatedxe2x80x94such as ensuring that two copies of the same purchase order are not processed, etc. A message transaction is an activity or a request, such as an order, a purchase, a change, or an addition to a database of information. Transactions usually update one or more files on a non-volatile storage such as a hard disk drive, and thus can serve as both an audit trail and a history for future analyses.
Message transaction systems can be online or offline. Online systems are also referred to as real-time systems, where transactions are processed and the appropriate files updated as soon as transactions are entered or received. Typically, confirmations are then returned to the sender. Thus, for online systems, usually a single message transaction is processed at a time. Offline systems, by comparison, do not process transactions as soon as they are entered or received. Rather, a number of message transactions are processed as a batchxe2x80x94for example, at the end of the business day, once a week, etc. Because organizations increasingly need to keep their data timely all of the time, they are more and more resorting to online message transaction systems.
A single message transaction is considered committed when the transaction has been completely processed. An issue is raised, therefore, when the system crashes while a message transactions is being processed. Upon recovery, it is important to determine whether the processing of the entire message transaction has been completed, such that it has been committed. If the single transaction has been committed, then usually nothing more needs to be done with respect to this transaction, and the system can proceed with processing other transactions. However, if the transaction has been only partly processed, then the transaction has to be aborted, such that the entity that had submitted the message will need to resubmit the message. This helps to ensure that each transaction is atomic.
A difficulty lies in determining after a system crash whether the transaction has only been partly processed, such that it has not been committed and the transaction needs to be aborted, or completely processed, such that the transaction has been committed. A common approach is to utilize two input/output (I/O) sessions. The transaction data that moves the transaction from a non-committed state to a committed state is first written to the non-volatile storage (such as a hard disk drive), in a first I/O session. A second I/O session is then instituted only after the first I/O session is complete, noting the fact that the first I/O session has been completed. Thus, on recovery from a crash, the message transaction system aborts all transactions for which the first I/O session appears, but the second I/O session does not, assuming that the first I/O session may not have been completed.
However, this is an expensive process from a performance perspective. Multiple I/O sessions are required to commit a single transaction to non-volatile storage. For large-scale systems processing millions of transactions on a global basis, the performance penalty resulting from the two-I/O session approach can be substantial. For this and other reasons, therefore, there is a need for the present invention.
The invention relates to utilizing only a single input/output (I/O) session to commit a single message transaction to a non-volatile storage within a message transaction system. In one embodiment, a method first determines an error detection value, such as a checksum, for a single transaction. The single transaction and the error detection value are written to the non-volatile storage, such as a hard disk drive, in only a single I/O session. Thus, the single transaction is committed upon the successful writing of the single transaction and the error detection value to the non-volatile storage.
In one embodiment, if a system failure results during the processing of the transaction, then upon recovery, the single transaction and the error detection value are read from the non-volatile storage. The error detection value is redetermined from the transaction as read from the storage; if the error detection value as redetermined varies from the error detection value as read from the storage, then this means that the transaction has not been completely processed, and it is aborted. Otherwise, if the redetermined value matches the read value, then this means that the single transaction has been committed.
Embodiments of the invention provide for advantages not found within the prior art. Significantly, only a single I/O session is required to commit a single message transaction to a non-volatile storage, while still ensuring that detection of whether the transaction has been completely processed, and therefore committed, is possible upon recovery from a system failure. This is as compared to the prior art approach, which requires two I/O sessions to allow for detection of complete transaction processing upon recovery from a system failure. Thus, embodiments of the invention allow for gains in transaction processing performance to be realized.